<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
<html>
<head>
<!-- Copyright 1997 The Open Group, All Rights Reserved -->
<title>c89</title>
</head><body bgcolor=white>
<center>
<font size=2>
The Single UNIX &reg; Specification, Version 2<br>
Copyright &copy; 1997 The Open Group

</font></center><hr size=2 noshade>
<xref type="10" name="c89"></xref>
<h4><a name = "tag_000_000_191">&nbsp;</a>NAME</h4><blockquote>
c89 - compile standard C programs
</blockquote><h4><a name = "tag_000_000_192">&nbsp;</a>SYNOPSIS</h4><blockquote>
<pre><code>

c89 <b>[</b>-c<b>][</b>-D <i>name</i><b>[</b>=<i>value</i><b>]]</b>...<b>[</b>-E<b>][</b>-g<b>][</b>-I <i>directory</i><b>]</b> ... <b>[</b>-L <i>directory</i><b>]</b>
... <b>[</b>-o <i>outfile</i><b>][</b>-O<b>][</b>-s<b>][</b>-U <i>name</i><b>]</b> ... <i>operand</i> ...
</code>
</pre>
</blockquote><h4><a name = "tag_000_000_193">&nbsp;</a>DESCRIPTION</h4><blockquote>
The
<i>c89</i>
utility is an interface to the standard C compilation system;
it will accept source code conforming to the ISO&nbsp;C standard.
The system conceptually consists of a
compiler and link editor.
The files referenced by
<i>operand</i>s
will be compiled and
linked to produce an executable file.
(It is unspecified whether the linking occurs
entirely within the operation of
<i>c89</i>;
some systems may produce objects that are
not fully resolved until the file is executed.)
<p>
If the
<b>-c</b>
option is specified,
for all pathname operands of the form
<i>file</i>.c
the files:
<pre>
<code>
$(basename <i>pathname</i> .c).o
</code>
</pre>
will be created as the result of successful compilation.
If the
<b>-c</b>
option is not specified,
it is unspecified whether such
.o
files are created or deleted for the
<i>file</i>.c
operands.
<p>
If there are no options that prevent link editing (such as
<b>-c</b>
or
<b>-E</b>),
and all operands compile and
link without error, the resulting executable file will be
written according to the
<b>-o</b>&nbsp;<i>outfile</i>
option (if present) or to the file
<b>a.out</b>.
<p>
The executable file will be created as specified in the <b>XSH</b> specification,
except that the file permissions will be set to:
<pre>
<dl compact><dt> <dd>
S_IRWXO | S_IRWXG | S_IRWXU
</dl>
</pre>
and that the bits
specified by the
<i>umask</i>
of the process will be cleared.
</blockquote><h4><a name = "tag_000_000_194">&nbsp;</a>OPTIONS</h4><blockquote>
The
<i>c89</i>
utility supports the <b>XBD</b> specification, <a href="../xbd/utilconv.html#usg"><b>Utility Syntax Guidelines</b>&nbsp;</a> ,
except that:
<ul>
<p>
<li>
The
<b>-l</b>&nbsp;<i>library</i>
operands have the format of options, but their position
within a list of operands affects the order in which libraries
are searched.
<p>
<li>
The order of specifying the
<b>-I</b>
and
<b>-L</b>
options is significant.
<p>
<li>
Portable applications must specify
each option separately; that is, grouping option letters
(for example,
<b>-cO</b>)
need not be recognised by all implementations.
<p>
</ul>
<p>
The following options are supported:
<dl compact>

<dt><b>-c</b>
<dd>Suppress the link-edit phase of the compilation, and
do not remove any object files that are produced.

<dt><b>-g</b>
<dd>Produce symbolic information in the object or executable
files; the nature of this information is unspecified,
and may be modified by implementation-dependent
interactions with other options.

<dt><b>-s</b>
<dd>Produce object or executable files, or both, from which
symbolic and other information not required for proper
execution using the <b>XSH</b> specification
<i>exec</i>
family has been removed (stripped).
If both
<b>-g</b>
and
<b>-s</b>
options are present, the action taken is unspecified.

<dt><b>-o&nbsp;</b><i>outfile</i>
<dd>
Use the pathname
<i>outfile</i>,
instead of the default
<b>a.out</b>,
for the executable file produced.
If the
<b>-o</b>
option is present with
<b>-c</b>
or
<b>-E</b>,
the result is unspecified.

<dt><b>-D</b><i> name</i><b>[=</b><i>value</i><b>]</b><dd>
Define
<i>name</i>
as if by a C-language
<b>#define</b>
directive.
If no
<i>=value</i>
is given,
a value of 1 will be used.
The
<b>-D</b>
option has lower precedence than the
<b>-U</b>
option.
That is, if
<i>name</i>
is used in both a
<b>-U</b>
and a
<b>-D</b>
option,
<i>name</i>
will be undefined regardless of the order of the options.
Additional implementation-dependent
<i>names</i>
may be provided by the compiler.
Implementations support at least 2048 bytes of
<b>-D</b>
definitions
and 256
<i>names</i>.

<dt><b>-E</b>
<dd>Copy C-language source files to standard output, expanding
all preprocessor directives; no compilation will be performed.
If any operand is not a text file, the effects are unspecified.

<dt><b>-I&nbsp;</b><i>directory</i>
<dd>
Change the algorithm for searching for headers
whose names
are not absolute pathnames
to look in the directory named by the
<i>directory</i>
pathname before looking in the usual places.
Thus, headers
whose names are enclosed in double-quotes (<b>""</b>)
will be searched for first in
the directory of the file with the
<b>#include</b>
line,
then in directories
named in
<b>-I</b>
options, and last in the
usual places.
For headers
whose names are enclosed in
angle brackets
(&lt;&gt;),
the header will be searched for only
in directories named in
<b>-I</b>
options and then in the
usual places.
Directories named in
<b>-I</b>
options will be searched
in the order specified.
Implementations support at least ten
instances of this option in a single
<i>c89</i>
command invocation.

<dt><b>-L&nbsp;</b><i>directory</i>
<dd>
Change the algorithm of searching for the libraries named in the
<b>-l</b>
objects to look in the directory named
by the
<i>directory</i>
pathname before looking in the
usual places.
Directories named in
<b>-L</b>
options will be searched in the order specified.
Implementations support at least ten
instances of this option in a single
<i>c89</i>
command invocation.
If a directory specified by a
<b>-L</b>
option contains files named
<b>libc.a</b>,
<b>libm.a</b>,
<b>libl.a</b>,
or
<b>liby.a</b>,
the results are unspecified.

<dt><b>-O</b>
<dd>Optimise.
The nature of the optimisation is unspecified.

<dt><b>-U&nbsp;</b><i>name</i>
<dd>
Remove any initial definition of
<i>name</i>.

</dl>
<p>
Multiple instances of the
<b>-D</b>,
<b>-I</b>,
<b>-U</b>
and
<b>-L</b>
options can be specified.
</blockquote><h4><a name = "tag_000_000_195">&nbsp;</a>OPERANDS</h4><blockquote>
An
<i>operand</i>
is either in the form of a pathname or the form
<b>-l</b>&nbsp;<i>library</i>.
At least one operand of the pathname form must be specified.
The following operands are supported:
<dl compact>

<dt><i>file.</i><b>c</b><dd>A C-language source file to be compiled and optionally linked.
The operand must be of this form if the
<b>-c</b>
option is used.

<dt><i>file.</i><b>a</b><dd>A library of object files typically produced by the
<i><a href="ar.html">ar</a></i>
utility,
and passed directly to the link editor.
Implementations may recognise
implementation-dependent
suffixes other than
.a
as denoting object file libraries.

<dt><i>file.</i><b>o</b><dd>An object file produced by
<i>c89</i>
<b>-c</b>
and passed directly to the link editor.
Implementations may recognise
implementation-dependent
suffixes other than
.o
as denoting object files.

</dl>
<p>
The processing of other files is implementation-dependent.
<dl compact>

<dt><b>-l&nbsp;</b><i>library</i>
<dd>
(The letter ell.)
Search the library named:
<pre>
<code>
lib<i>library</i>.a
</code>
</pre>

A library will be searched when its name is
encountered, so the placement of a
<b>-l</b>
operand is significant.
Several standard libraries can be specified in this manner,
as described in the EXTENDED DESCRIPTION section.
Implementations may recognise implementation-dependent
suffixes other than
.a
as denoting libraries.

</dl>
</blockquote><h4><a name = "tag_000_000_196">&nbsp;</a>STDIN</h4><blockquote>
Not used.
</blockquote><h4><a name = "tag_000_000_197">&nbsp;</a>INPUT FILES</h4><blockquote>
The input file must be one of the following:
a text file containing a
C-language source program; an object file in the
format produced by
<i>c89</i>
<b>-c</b>
or a library of object files, in the format produced by
archiving zero or more object files, using
<i><a href="ar.html">ar</a></i>.
Implementations may supply additional utilities
that produce files in these formats.
Additional input file formats are implementation-dependent.
</blockquote><h4><a name = "tag_000_000_198">&nbsp;</a>ENVIRONMENT VARIABLES</h4><blockquote>
The following environment variables affect the execution of
<i>c89</i>:
<dl compact>

<dt><i>LANG</i><dd>Provide a default value for the internationalisation variables
that are unset or null.
If
<i>LANG</i>
is unset or null, the corresponding value from the
implementation-dependent default locale will be used.
If any of the internationalisation variables contains an invalid setting, the
utility will behave as if none of the variables had been defined.

<dt><i>LC_ALL</i><dd>
If set to a non-empty string value,
override the values of all the other internationalisation variables.

<dt><i>LC_CTYPE</i><dd>
Determine the
locale for the interpretation of sequences of bytes of text data as
characters (for example, single- as opposed to multi-byte characters
in arguments and input files).

<dt><i>LC_MESSAGES</i><dd>
Determine the locale that should be used to affect
the format and contents of diagnostic
messages written to standard error.

<dt><i>NLSPATH</i><dd>
Determine the location of message catalogues
for the processing of
<i>LC_MESSAGES .
</i>
<dt><i>TMPDIR</i><dd>
Provide a pathname that
&nbsp;will override
&nbsp;the default directory for temporary files, if any.

</dl>
</blockquote><h4><a name = "tag_000_000_199">&nbsp;</a>ASYNCHRONOUS EVENTS</h4><blockquote>
Default.
</blockquote><h4><a name = "tag_000_000_200">&nbsp;</a>STDOUT</h4><blockquote>
If more than one file operand ending in
.c
(or possibly other unspecified suffixes) is given,
for each such file:
<p><code>
<tt>"%s:\n"</tt>, &lt;<i>file</i>&gt;
</code>
may be written.
These messages, if written, will precede the processing of each input file;
they will not be written to the standard output if they are
written to the standard error, as described in the STDERR section.
<p>
If the
<b>-E</b>
option is specified, the standard output will be a text file
that represents the results of the preprocessing stage of the language;
it may contain extra information appropriate for subsequent
compilation passes.
</blockquote><h4><a name = "tag_000_000_201">&nbsp;</a>STDERR</h4><blockquote>
Used only for diagnostic messages.
If more than one file operand ending in
.c
(or possibly other unspecified suffixes) is given,
for each such file:
<p><code>
<tt>"%s:\n"</tt>, &lt;<i>file</i>&gt;
</code>
may be written to allow identification of the diagnostic
and warning messages with the appropriate input file.
These messages, if written, will precede the processing of each input file;
they will not be written to the standard error if they are
written to the standard output, as described in the STDOUT section.
<p>
This utility may produce warning messages about certain
conditions that do not warrant returning an error (non-zero)
exit value.
</blockquote><h4><a name = "tag_000_000_202">&nbsp;</a>OUTPUT FILES</h4><blockquote>
Object files or executable files or both are produced in unspecified formats.
</blockquote><h4><a name = "tag_000_000_203">&nbsp;</a>EXTENDED DESCRIPTION</h4><blockquote>
<h5><a name = "tag_000_000_203_001">&nbsp;</a>Standard Libraries</h5>
The
<i>c89</i>
utility recognises the following
<b>-l</b>
operands for standard libraries:
<dl compact>

<dt><b>-l c</b>
<dd>This operand makes visible all library functions referenced in
the <b>XSH</b> specification with the possible exception of those functions listed
as residing in
<i><a href="../xsh/aio.h.html">&lt;aio.h&gt;</a></i>,
<i><a href="../xsh/math.h.html">&lt;math.h&gt;</a></i>,
<i><a href="../xsh/mqueue.h.html">&lt;mqueue.h&gt;</a></i>,
<i><a href="../xsh/pthread.h.html">&lt;pthread.h&gt;</a></i>,
<i><a href="../xsh/sched.h.html">&lt;sched.h&gt;</a></i>,
<i><a href="../xsh/semaphore.h.html">&lt;semaphore.h&gt;</a></i>,
<i><a href="../xsh/pthread_atfork.html">pthread_atfork()</a></i>
in
<i><a href="../xsh/unistd.h.html">&lt;unistd.h&gt;</a></i>
and those functions marked as an RT extension in
<i><a href="../xsh/sysmman.h.html">&lt;sys/mman.h&gt;</a></i>
and
<i><a href="../xsh/time.h.html">&lt;time.h&gt;</a></i>.
This operand is not required to be present to cause a search
of this library.

<dt><b>-l l</b>
<dd>This operand makes visible all functions required by the C-language output of
<i><a href="lex.html">lex</a></i>
that are not made available through the
<b>-l c</b>
operand.

<dt><b>-l pthread</b>
<dd>
This operand makes visible all functions referenced in
<i><a href="../xsh/pthread.h.html">&lt;pthread.h&gt;</a></i>
and
<i><a href="../xsh/pthread_atfork.html">pthread_atfork()</a></i>
referenced in
<i><a href="../xsh/unistd.h.html">&lt;unistd.h&gt;</a></i>.
An implementation may search this library in the absence of this
operand.

<dt><b>-l m</b>
<dd>This operand makes visible all functions referenced in
<i><a href="../xsh/math.h.html">&lt;math.h&gt;</a></i>.
An implementation may search this library in the absence of this operand.

<dt><b>-l rt</b>
<dd>This operand makes visible all functions referenced in
<i><a href="../xsh/aio.h.html">&lt;aio.h&gt;</a></i>,
<i><a href="../xsh/mqueue.h.html">&lt;mqueue.h&gt;</a></i>,
<i><a href="../xsh/sched.h.html">&lt;sched.h&gt;</a></i>
and
<i><a href="../xsh/semaphore.h.html">&lt;semaphore.h&gt;</a></i>,
and those functions marked as an RT extension in
<i><a href="../xsh/sysmman.h.html">&lt;sys/mman.h&gt;</a></i>
and
<i><a href="../xsh/time.h.html">&lt;time.h&gt;</a></i>.
An implementation may search this library in the absence of this
operand.

<dt><b>-l y</b>
<dd>This operand makes visible all functions required by the C-language output of
<i><a href="yacc.html">yacc</a></i>
that are not made available through the
<b>-l c</b>
operand.

</dl>
<p>
In the absence of options that inhibit invocation
of the link editor, such as
<b>-c</b>
or
<b>-E</b>,
the
<i>c89</i>
utility will cause the equivalent of a
<b>-l c</b>
operand to be passed to the link editor as the last
<b>-l</b>
operand, causing it to be searched after all other object files
and libraries are loaded.
<p>
It is unspecified whether the libraries
<b>libc.a</b>,
<b>libm.a</b>,
<b>librt.a</b>,
<b>libpthread.a</b>,
<b>libl.a</b>
or
<b>liby.a</b>
exist as regular files.
The implementation may accept as
<b>-l</b>
operands names of objects that do not exist as regular files.
<p>
<h5><a name = "tag_000_000_203_002">&nbsp;</a>External Symbols</h5>
The C compiler and link editor
support the significance of external symbols up to a
length of at least 31 bytes;
the action taken upon encountering
symbols exceeding the implementation-dependent
maximum symbol length is unspecified.
<p>
The compiler and link editor
support a minimum of 511 external
symbols per source or object file,
and a minimum of 4095 external symbols in total.
A diagnostic message will be written to the standard output
if the implementation-dependent limit is exceeded;
other actions are unspecified.
<h5><a name = "tag_000_000_203_003">&nbsp;</a>Programming Environments</h5>
<p>
All implementations will support one of the following programming
environments as a default.
Implementations may support more than one of the following programming
environments.
Applications can use
<i><a href="../xsh/sysconf.html">sysconf()</a></i>
or
<i><a href="getconf.html">getconf</a></i>
to determine which programming environments are supported.
<pre>
<table  bordercolor=#000000 border=1 align=center><tr valign=top><th align=center><b>Programming Environment<br><i>getconf</i> Name</b>
<th align=center><b>Bits in<br> int</b>
<th align=center><b>Bits in<br> long</b>
<th align=center><b>Bits in<br> pointer</b>
<th align=center><b>Bits in<br> off_t</b>
<tr valign=top><td align=left>_XBS5_ILP32_OFF32
<td align=left>32
<td align=left>32
<td align=left>32
<td align=left>32
<tr valign=top><td align=left>_XBS5_ILP32_OFFBIG
<td align=left>32
<td align=left>32
<td align=left>32
<td align=left>&gt;= 64
<tr valign=top><td align=left>_XBS5_LP64_OFF64
<td align=left>32
<td align=left>64
<td align=left>64
<td align=left>64
<tr valign=top><td align=left>_XBS5_LPBIG_OFFBIG
<td align=left>&gt;= 32
<td align=left>&gt;= 64
<td align=left>&gt;= 64
<td align=left>&gt;= 64
</table>
</pre>
<h6 align=center><xref table="Programming Environments - Type Sizes"><a name="tagt_1">&nbsp;</a></xref>Table: Programming Environments - Type Sizes</h6>
<p>
Implementations provide configuration strings for C compiler flags,
linker/loader flags and libraries for each supported environment.
When an application needs to use a specific programming environment
rather than the implementation default programming environment while
compiling, the application must first verify that the implementation
supports the desired environment.
If the desired programming environment is supported, the application
must then invoke
<i>c89</i>
with the appropriate C compiler flags as the first options for the
compile, the appropriate linker/loader flags after any other options
but before any operands, and the appropriate libraries at the end of
the operands.
<p>
Portable applications must not attempt to link together object files
compiled for different programming models.
Applications must also be aware that binary data placed in shared
memory or in files might not be recognised by applications built for
other programming models.
<pre>
<table  bordercolor=#000000 border=1 align=center><tr valign=top><th align=center><b>Programming Environment<br><i>getconf</i> Name</b>
<th align=center><b>Use</b>
<th align=center><b><i>c89</i> and <i>cc</i> Arguments<br><i>getconf</i> Name</b>
<tr valign=top><td align=left>_XBS5_ILP32_OFF32
<td align=left>C Compiler Flags
<td align=left>XBS5_ILP32_OFF32_CFLAGS
<tr valign=top><td align=left>&nbsp;
<td align=left>Linker/Loader Flags
<td align=left>XBS5_ILP32_OFF32_LDFLAGS
<tr valign=top><td align=left>&nbsp;
<td align=left>Libraries
<td align=left>XBS5_ILP32_OFF32_LIBS
<tr valign=top><td align=left>_XBS5_ILP32_OFFBIG
<td align=left>C Compiler Flags
<td align=left>XBS5_ILP32_OFFBIG_CFLAGS
<tr valign=top><td align=left>&nbsp;
<td align=left>Linker/Loader Flags
<td align=left>XBS5_ILP32_OFFBIG_LDFLAGS
<tr valign=top><td align=left>&nbsp;
<td align=left>Libraries
<td align=left>XBS5_ILP32_OFFBIG_LIBS
<tr valign=top><td align=left>_XBS5_LP64_OFF64
<td align=left>C Compiler Flags
<td align=left>XBS5_LP64_OFF64_CFLAGS
<tr valign=top><td align=left>&nbsp;
<td align=left>Linker/Loader Flags
<td align=left>XBS5_LP64_OFF64_LDFLAGS
<tr valign=top><td align=left>&nbsp;
<td align=left>Libraries
<td align=left>XBS5_LP64_OFF64_LIBS
<tr valign=top><td align=left>_XBS5_LPBIG_OFFBIG
<td align=left>C Compiler Flags
<td align=left>XBS5_LPBIG_OFFBIG_CFLAGS
<tr valign=top><td align=left>&nbsp;
<td align=left>Linker/Loader Flags
<td align=left>XBS5_LPBIG_OFFBIG_LDFLAGS
<tr valign=top><td align=left>&nbsp;
<td align=left>Libraries
<td align=left>XBS5_LPBIG_OFFBIG_LIBS
</table>
</pre>
<h6 align=center><xref table="Programming Environments - <I>c89</i> and <i>cc</i> Arguments"></xref>Table: Programming Environments - <i>c89</i> and <i>cc</i> Arguments</h6>
</blockquote><h4><a name = "tag_000_000_204">&nbsp;</a>EXIT STATUS</h4><blockquote>
The following exit values are returned:
<dl compact>

<dt>0<dd>Successful compilation or link edit.

<dt>&gt;0<dd>An error occurred.

</dl>
</blockquote><h4><a name = "tag_000_000_205">&nbsp;</a>CONSEQUENCES OF ERRORS</h4><blockquote>
When
<i>c89</i>
encounters a compilation error that causes an object file not to
be created, it will write a diagnostic to standard error
and continue to compile other source code operands, but it
will not perform the link phase and will return a non-zero exit status.
If the link edit is unsuccessful,
a diagnostic message will be written to standard error and
<i>c89</i>
will exit with a non-zero status.
A portable application must rely on the exit status of
<i>c89</i>,
rather than on the existence or mode of the executable file.
</blockquote><h4><a name = "tag_000_000_206">&nbsp;</a>APPLICATION USAGE</h4><blockquote>
Since the
<i>c89</i>
utility
usually creates files in the current
directory during the compilation process, it is typically
necessary to run the
<i>c89</i>
utility
in a directory in which a file can be created.
<p>
On systems conforming to the ISO/IEC 9945-2:1993 standard,
<i>c89</i>
may be provided only as part of the C-Language Development Option;
XSI-conformant systems always provide
<i>c89</i>.
<p>
Some historical implementations have created
<b>.o</b>
files when
<b>-c</b>
is not specified and more than one source file is given.
Since this area is left unspecified, the application cannot
rely on
<b>.o</b>
files being created, but it also must be prepared
for any related
<b>.o</b>
files that already exist being deleted at the
completion of the link edit.
<p>
Some historical implementations have permitted
<b>-L</b>
options to be interspersed with
<b>-l</b>
operands on the command line.
For an application to compile consistently on systems
that do not behave like this, it is necessary for a
portable application to supply all
<b>-L</b>
options before
any of the
<b>-l</b>
options.
<p>
There is the possible implication that if a user supplies versions
of the standard library functions (before they would be encountered
by an implicit
<b>-l c</b>
or explicit
<b>-l m</b>),
that those versions would
be used in place of the standard versions.
There are various reasons
this might not be true (functions defined as macros, manipulations
for clean name space, and so on), so the existence of files named
in the same manner as the standard libraries within the
<b>-L</b>
directories is explicitly stated to produce unspecified behaviour.
<p>
All of the interfaces specified in the <b>XSH</b> specification may be made visible by
implementations when the Standard C Library is searched.
Portable applications must explicitly request searching the other
standard libraries when functions made visible by those
libraries are used.
<p>
An application strictly portable to the ISO/IEC 9945-2:1993 standard cannot rely on
<i>TMPDIR</i>
overriding the default temporary directory.
On XSI-conformant systems, however, this will always be the case.
</blockquote><h4><a name = "tag_000_000_207">&nbsp;</a>EXAMPLES</h4><blockquote>
The following are examples of usage:
<dl compact>

<dt>c89 -o foo foo.c<dd>
Compiles
<b>foo.c</b>
and creates the executable file
<b>foo</b>.

<dt>c89 -c foo.c<dd>
Compiles
<b>foo.c</b>
and creates the object file
<b>foo.o</b>.

<dt>c89 foo.c<dd>
Compiles
<b>foo.c</b>
and creates the executable file
<b>a.out</b>.

<dt>c89 foo.c bar.o<dd>
Compiles
<b>foo.c</b>
links it with
<b>bar.o</b>,
and creates the
executable file
<b>a.out</b>.
Also creates and leaves
<b>foo.o</b>.

</dl>
<p>
The following example shows how an application using threads
interfaces can test for support of and use a programming environment
supporting 32-bit 
<b>int</b>,
<b>long</b>
and
<b>pointer</b>
types and an
<b>off_t</b>
type using at least 64 bits:
<pre>
<code>
if [ $(getconf _XBS5_ILP32_OFFBIG) != "-1" ]
then
    c89 $(getconf XBS5_ILP32_OFFBIG_CFLAGS) -D_XOPEN_SOURCE=500 \
        $(getconf XBS5_ILP32_OFFBIG_LDFLAGS) foo.c -o foo \
        $(getconf XBS5_ILP32_OFFBIG_LIBS) -l pthread
else
    echo ILP32_OFFBIG programming environment not supported
    exit 1
fi
</code>
</pre>
<p>
The following examples clarify the use and interactions of
<b>-L</b>
options and
<b>-l</b>
operands:
<ol>
<p>
<li>
Consider the case in which module
<b>a.c</b>
calls function
<i>f()</i>
in library
<b>libQ.a</b>,
and module
<b>b.c</b>
calls function
<i>g()</i>
in library
<b>libp.a</b>.
Assume that both libraries reside in
<b>/a/b/c</b>.
The command
line to compile and link in the desired way is:
<pre>
<code>
c89 -L /a/b/c main.o a.c -l Q b.c -l p
</code>
</pre>
In this case the
<b>-l Q</b>
operand need only precede the first
<b>-l p</b>
operand, since both
<b>libQ.a</b>
and
libp.a
reside in the same directory.
<br>
<p>
<li>
Multiple
<b>-L</b>
operands can be used when library name collisions occur.
Building on the previous example,
suppose that the user wants to use a new
<b>libp.a</b>,
in
<b>/a/a/a</b>,
but still wants
<i>f()</i>
from
<b>/a/b/c/libQ.a</b>:
<pre>
<code>
c89 -L /a/a/a -L /a/b/c main.o a.c -l Q b.c -l p
</code>
</pre>
<p>
In this example,
the linker searches the
<b>-L</b>
options in the order specified,
and finds
<b>/a/a/a/libp.a</b>
before
<b>/a/b/c/libp.a</b>
when resolving references for
<b>b.c</b>.
The order of the
<b>-l</b>
operands is still important, however.
<p>
</ol>
</blockquote><h4><a name = "tag_000_000_208">&nbsp;</a>FUTURE DIRECTIONS</h4><blockquote>
None.
</blockquote><h4><a name = "tag_000_000_209">&nbsp;</a>SEE ALSO</h4><blockquote>
<i><a href="ar.html">ar</a></i>,
<i><a href="cc.html">cc</a></i>,
<i><a href="getconf.html">getconf</a></i>,
<i><a href="make.html">make</a></i>,
<i><a href="nm.html">nm</a></i>,
<i><a href="strip.html">strip</a></i>,
the <b>XSH</b> specification description of
<i><a href="../xsh/sysconf.html">sysconf()</a></i>,
<i><a href="umask.html">umask</a></i>.
</blockquote><hr size=2 noshade>
<center><font size=2>
UNIX &reg; is a registered Trademark of The Open Group.<br>
Copyright &copy; 1997 The Open Group
<br> [ <a href="../index.html">Main Index</a> | <a href="../xshix.html">XSH</a> | <a href="../xcuix.html">XCU</a> | <a href="../xbdix.html">XBD</a> | <a href="../cursesix.html">XCURSES</a> | <a href="../xnsix.html">XNS</a> ]

</font></center><hr size=2 noshade>
</body></html>
